import React, { Component } from 'react';
import { connect } from 'dva';
import './myinterviewrecords.less';
import { Table, Divider, Tag, Icon, Checkbox, Button, Input } from 'antd';
import 'antd/dist/antd.css';
import { _selectMe } from '@/api/infoapi';
import { CheckboxChangeEvent } from '_antd@3.26.20@antd/lib/checkbox';
import Link from 'umi/link';
import moment from 'moment';
const { Search } = Input;

const columns = [
  {
    title: '名字',
    dataIndex: 'name',
    key: 'name',
    render: (
      text: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined,
    ) => <a>{text}</a>,
  },
  {
    title: '专业',
    dataIndex: 'majorName',
    key: 'majorName',
  },
  {
    title: '版本号',
    dataIndex: 'stationVersion',
    key: 'stationVersion',
  },
  {
    title: '技能数量',
    dataIndex: 'skillNum',
    key: 'skillNum',
  },
  {
    title: '作者',
    dataIndex: 'userName',
    key: 'userName',
  },
  {
    title: '发起时间',

    key: 'createTime',
    // dataIndex: moment("createTime").format('YYYY-MM-DD '),
    render: (record: any) => {
      return moment(record.createTime).format('YYYY-MM-DD ');
    },
  },

  {
    title: '状态',
    key: 'action',
    render: (
      text: any,
      record: {
        name:
          | string
          | number
          | boolean
          | {}
          | React.ReactElement<any, string | React.JSXElementConstructor<any>>
          | React.ReactNodeArray
          | React.ReactPortal
          | null
          | undefined;
      },
    ) => <span>已发布</span>,
  },
  {
    title: '操作',
    key: 'stationId',
    render: () => (
      <span>
        <Icon type="eye" />
      </span>
    ),
  },
];

const mapStateToProps = (state: { app: any }, ownProps: any) => {
  return state.app;
};
@connect(mapStateToProps)
class Myinterviewrecords extends Component {
  state = {

  };
  render() {

    return (
      <div className="station_box">
        
        {/* 表格部分 */}
        <div className="station_main">
          <div className="tableHeader">
            <div className="search">
              <Search
                placeholder="搜索岗位"
                onSearch={value1 => {
                  this.changeFilter(value1);
                }}
                style={{ width: 200 }}
                // value={this.state.value}
              />
            </div>
          </div>
          <Table columns={columns} rowKey="stationId" dataSource={this.props.selectStationForm} />
        </div>
      </div>
    );
  }
  componentDidMount() {
    this.props.dispatch({ type: 'app/selectStationForm' });
  }
  async changeFilter(value: CheckboxChangeEvent) {
    let res = await _selectMe({
      isAsc: 'desc',
      pageNum: 1,
      pageSize: 10,
      searchTitle: value,
      majorId: '',
      status: '',
      isMyInfo: false,
      proName: '',
    });
    // console.log(res.data.rows,"筛选");
    if (value != null) {
      this.props.dispatch({ type: 'app/selectStationForm', action: res.data.rows });
    } else {
      this.setState({
        selectStationForm: this.props.selectStationForm,
      });
    }
  }

 
}
export default Myinterviewrecords;

